<?php

class controllerProfession {

    public static function get($int) {
        $sql = "SELECT * FROM  `professions` where `_id` = " . $int;
        $query = MySql::query($sql);
        while ($row = mysql_fetch_object($query)) {
            $profession = new modelProfession();
            return $profession->deserialize($row);
        }
    }
    
    public static function getOptionList($int = null) {
        $sql = "SELECT * FROM `professions`";
        $query = MySql::query($sql);
        while ($row = mysql_fetch_object($query)) {
            if($row->_id == $int)
                $selected = "selected='selected'";
            echo "<option value=" . $row->_id . ">" . htmlentities($row->name) . "</option>";
        }
    }

}

?>
